<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>按钮一</button>
    <button>按钮二</button>
    <script>
        // function test(){
        //     console.log("test");
        // }

        var btns = document.querySelectorAll("button");
        var a;

        btns[0].onclick = function(){
             a = 10;
        }

        btns[1].onclick = function(){
            // 1.局部定义 2.局部传参
            // var a = 10;
            console.log(a);
        }
        


    </script>
</body>
</html>